package org.dragonnova.business.validator.validator;

import javax.validation.ConstraintValidator;
import javax.validation.ConstraintValidatorContext;

import org.dragonnova.business.validator.IntegerType;
import org.springframework.util.StringUtils;

/** 
 */
public class IntegerTypeValidator implements ConstraintValidator<IntegerType, Integer> {

	@Override
	public void initialize(IntegerType constraintAnnotation) {
	}

	@Override
	public boolean isValid(Integer value, ConstraintValidatorContext context) {
		if (StringUtils.isEmpty(value)) {
			return true;
		}
		if (value ==null) {
			return false;// 验证失败
		}
		return true;
	}
}